$(function initValidate() {

    jQuery.validator.addMethod("sUserName", function (value, element) {
        var reg=/^[a-z A-Z \d]{6,10}$/;
       var userState= (reg.test(value));
       if(value==''){
           $("#userName").attr("subUser","false");
       }
       if (userState){
           $("#userName").attr("subUser",userState);
       }else if(reg.test($("#userName").val())){
           $("#userName").attr("subUser","true");
       }


        return userState;
    },"必须是数字和字母,个数在6~10")


    jQuery.validator.addMethod("sUserPassword", function (value, element) {
        var reg=/^[\S]{6,10}$/
        var password = (reg.test(value));
       if(value==''){
           $("#password").attr("subPassword","false");
       }
       if (password){
            $("#password").attr("subPassword",password);
        }else if(reg.test($("#password").val())){
            $("#password").attr("subPassword","true");
        }
        return password;
    },"密码个数在6~10,不能有空格")


    jQuery.validator.addMethod("sCode", function (value, element) {
        var subCod = (/^[a-z A-Z \d]{6}$/.test(value));
        if ( value==''){
            $("#verificationCode").attr("subCode","false");
        }

        if (subCod){
            $("#password").attr("subPassword",subCod);
        }else if (subCod){
            $("#verificationCode").attr("subCode",subCod);
        }
        console.log(subCod);
        return subCod;
    },"验证码个数为6,不能有空格")

    $("#form_verdict").validate({
        rules:{
            inputUserName: {
                sUserName:true
            },
            inputPassword: {
                sUserPassword: true
            },
            inputCode:{
                sCode:true
            }
        }
    })
})